package bento.api;

import java.util.List;

import bento.api.IBentoClient.IAcountManager.IAcount;
import bento.api.IQuerier.IField;

public interface IBentoClient {

    public IGate getGate();
    
    public IAcount getAcount();
    
    public IAcountManager getAcounts();
    
    public IStoreManager getStores();
    
    public IOrderManager getOrders();
    
    public interface IGate {
        public boolean login(String user, String password);
        public boolean logout();
    }
    
    public interface IAcountManager extends IManager<IAcountManager.IAcount> {
        
        @Override public IAcountX create();
        
        public interface IAcount extends IManager.IElem, bento.types.IAcount {
        }
        
        public interface IAcountX extends IAcount {
            public String getPassword();
        }
    }
    
    public interface IStoreManager extends IManager<IStoreManager.IStore> {
        public IField<String> getNameField();
        public IField<String> getTelField();
        
        public interface IStore extends IManager.IElem, bento.types.IStore {
            @Override public IStore setName(String name);
            @Override public IStore setTel(String tel);
            public IBentoManager getBentos();
            
            public interface IBentoManager extends IManager<IBentoManager.IBento> {
                
                public interface IBento extends IManager.IElem, bento.types.IStore.IBento {
                    @Override public IBento setName(String name);
                    @Override public IBento setPrice(int price);
                }
            }
        }
    }
    
    public interface IOrderManager extends IManager<IOrderManager.IOrder> {
        
        public interface IOrder extends IManager.IElem, bento.types.IOrder {
            public IDetailManager getDetails();
            
            public interface IDetailManager extends IManager<IDetailManager.IDetail> {
                
                public interface IDetail extends IManager.IElem, bento.types.IOrder.IDetail {
                }
            }
        }
    }
    
    public interface IRefreshAble {
        public void refresh();
    }
    
    public interface ICommitAble {
        public void commit();
    }
    
    public interface ICreatable<T> {
        T create();
    }
    
    public interface IWhereable<T> 
                extends IWhere<T> {
        public void whereReset();
    }
    
    public interface IList<TElem> extends List<TElem> {
        public void alert(TElem elem);
    }
    
    public interface IManager<TElem extends IManager.IElem> 
                     extends IList<TElem>, 
                             ICreatable<TElem>, 
                             IRefreshAble, 
                             ICommitAble, 
                             IWhereable<
                                 IQuerier<TElem>
                             > {
        
        public interface IElem extends IRefreshAble, ICommitAble {
            
        }
    }
}
